﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace PaperMaster.Chess.Enemy
{
    public class TestEnemyController : EnemyController
    {
        public TestEnemyController(SingleEnemyModel model) : base(model)
        {

        }

        float turntime = 1f;
        float timer = 0f;

        public override void FightBeginExecute()
        {
            Debug.Log("主角登场!");
        }

        protected override void OnBeginTurn()
        {
            timer = turntime;
            count = -2;
            Debug.Log("杀了你啊啊啊啊啊啊！");
            base.OnBeginTurn();
        }
        protected override void OnFinishTurn()
        {
            Debug.Log("草泥马啊啊啊啊啊啊！");
            base.OnFinishTurn();
        }
        int count = -2;
        public override void FrameFun()
        {
            if (BellController.GetTurn() == Turn.Oppoent)
            {
                timer -= Time.deltaTime;
                if (timer < 0)
                {
                    if (count >= 1)
                    {
                        FinishTurn();
                    }
                    else
                    {
                        timer = turntime;
                        count++;
                        ChessBoardViewController.GetController().SetPiece(PieceSpace.Piece.SamplePiece, PieceSpace.PieceOwner.Opponent, new Vector2Int(3 + count, 6));
                        if (count >= 1)
                        {
                            FinishTurn();
                        }
                    }
                }
            }
            base.FrameFun();
        }
    }
    public class TestEnemyViewController : EnemyViewController
    {
        private void Awake()
        {
            controller = new TestEnemyController(new SingleEnemyModel());
        }
        // Start is called before the first frame update
        void Start()
        {

        }

        // Update is called once per frame
        void Update()
        {
            controller.FrameFun();
        }
    }
}
